import { default as Accounts } from '../api/account'
import _routes_mcn from './routes_mcn'

let routes = [
  {
    path: '/',
    component: () => import('layouts/IndexLayout.vue'),
    children: [
      // { path: '', redirect:'douyin/videos' }
      { path: '', redirect:'event' }
    ]
  },
]

let _routes = [
  {
    path: '/',
    component: () => import('layouts/IndexLayout.vue'),
    children: [
      // { path: '', redirect:'douyin/videos' },
      { path: '', redirect:'event' },
      { path: 'movie', component: () => import('pages/IndexMovie.vue') },
      { path: 'event', component: () => import('pages/IndexEvent.vue') },
      { path: 'user', component: () => import('pages/IndexUser.vue') },
      { path: 'setting', component: () => import('pages/IndexSetting.vue') },
      { path: 'accounts', component: () => import('pages/IndexAccounts.vue') },
      { path: 'faq', component: () => import('pages/IndexFaq.vue') },
      { path: 'tool', component: () => import('pages/IndexTool.vue') },
      { path: 'share', component: () => import('pages/IndexShare.vue') },
      { path: 'author', component: () => import('pages/IndexAuthor.vue') },
      { path: 'project', component: () => import('pages/IndexProject.vue') },
      
      { path: 'event/seat/:id', component: () => import('pages/EventSeat.vue') },
      { path: 'event/mgroup/:id', component: () => import('pages/EventGroup.vue') },

      { path: 'plus/journal', component: () => import('pages/PlusJournal.vue') },
      
      { path: 'ticket', component: () => import('pages/TicketQuery.vue') }
    ]
  },
  {
    path: '/plus/topic',
    component: () => import('layouts/PlusTopicLayout.vue'),
    children: [
      { path: 'ticket', component: () => import('pages/PlusTopicTicket.vue') },
      { path: 'comment', component: () => import('pages/PlusTopicComment.vue') },
      { path: 'post', component: () => import('pages/PlusTopicPost.vue') },
    ]
  },
  {
    path: '/offical',
    component: () => import('layouts/OfficalLayout.vue'),
    children: [
      { path: 'accounts', component: () => import('pages/Offical/Index.vue') },
      { path: 'articals', component: () => import('pages/Offical/Articals.vue') },
      { path: 'tags', component: () => import('pages/Offical/Tags.vue') },
      { path: ':id', component: () => import('pages/Offical/Account.vue') },
    ]
  },
  {
    path: '/douyin',
    component: () => import('layouts/DouyinLayout.vue'),
    children: [
      { path: 'accounts', component: () => import('pages/Douyin/Index.vue') },
      { path: 'videos', component: () => import('pages/Douyin/Videos.vue') },
      { path: 'bgm', component: () => import('pages/Douyin/Bgm.vue') },
      { path: ':id', component: () => import('pages/Douyin/Account.vue') },
    ]
  }, 
  {
    path: '/douyinmcn',
    component: () => import('layouts/DouyinMcnLayout.vue'),
    children: [
      { path: 'accounts', component: () => import('pages/Douyin/Index.vue') },
      { path: 'videos', component: () => import('pages/Douyin/Videos.vue') },
      { path: ':id', component: () => import('pages/Douyin/Account.vue') },
    ]
  },
  {
    path: '/review',
    component: () => import('layouts/ReviewLayout.vue'),
    children: [
      { path: 'list', component: () => import('pages/IndexReview.vue') },
      { path: 'author', component: () => import('pages/ReviewAuthor.vue') },
    ]
  },
  {
    path: '/sms-code',
    component: () => import('layouts/IndexLayout.vue'),
    children: [
      { path: '', component: () => import('pages/SmsCode.vue') },
      { path: 'view/:id', component: () => import('pages/SmsCodeView.vue') },
      { path: 'edit/:id', component: () => import('pages/SmsCodeEdit.vue') },
      { path: 'view2/:id', component: () => import('pages/SmsTemplateCodeView.vue') },
      { path: 'edit2/:id', component: () => import('pages/SmsTemplateCodeEdit.vue') },
    ]
  },
  {
    path: '/doumail-code',
    component: () => import('layouts/IndexLayout.vue'),
    children: [
      { path: '', component: () => import('pages/DoumailCode.vue') },
      { path: 'view/:id', component: () => import('pages/DoumailCodeView.vue') },
      { path: 'edit/:id', component: () => import('pages/DoumailCodeEdit.vue') },
    ]
  },
  {
    path: '/douban/movie',
    component: () => import('layouts/IndexLayout.vue'),
    children: [
      { path: '', component: () => import('pages/IndexMovieDrecated.vue') },
      { path: 'search', component: () => import('pages/MovieSearch.vue') },
      { path: 'setting/:id', component: () => import('pages/MovieSetting.vue') },
      { path: ':id', component: () => import('pages/MovieFrame.vue') }
    ]
  },
  { 
    path: '/event/:id', component: () => import('layouts/EventLayout.vue'),
    children: [
      { path: 'setting', component: () => import('pages/EventSetting.vue') },
      { path: 'sign', component: () => import('pages/EventSign.vue') },
      { path: 'play', component: () => import('pages/EventPlay.vue') },
      { path: 'check', component: () => import('pages/EventCheck.vue') },
      { path: 'summary', component: () => import('pages/EventSummary.vue') }    
    ]
  },
  { 
    path: '/project', component: () => import('layouts/IndexLayout.vue'),
    children: [
      { path: ':id', component: () => import('pages/ProjectEdit.vue') }  
    ]
  },
  {
    path: '/movie',
    component: () => import('layouts/MovieLayout.vue'),
    children: [
      { path: ':id', component: () => import('pages/MovieMain.vue') }
    ]
  },
  {
    path: '/anon/event/:id/check',
    component: () => import('pages/AnonEventCheck.vue')
  },
  {
    path: '/login',
    component: () => import('pages/Login.vue')
  }
]


if( Accounts.isDouyinMcn() ){
  routes = [..._routes_mcn]
} else {
  routes = [..._routes]
}

//console.log( routes )

// Always leave this as last one
if (process.env.MODE !== 'ssr' ) {
  routes.push({
    path: '*',
    component: () => import('pages/Error404.vue')
  })
}

export default routes
